package com.yc.project.servlet;

import com.yc.project.dao.DishDao;
import com.yc.project.util.Utils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "ViewsServlet", value = "/views.s")
public class ViewsServlet extends HttpServlet {
/*查询菜品浏览量*/
    private DishDao dishDao = new DishDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        int viewsnum = dishDao.setViewsById(id);
        Utils.toJson(viewsnum, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
